import {Component, OnInit} from '@angular/core';
import{ActivatedRoute, Params}from "@angular/router";
@Component({
    selector: 'app-product',
    templateUrl: './product.component.html',
    styleUrls: ['./product.component.less']
})
export class ProductComponent implements OnInit {
    private products:Array<Product>;
    private testid:any;

    constructor(private routeParams:ActivatedRoute) {
    }

    ngOnInit() {
        let imgsrcStr:string = "C:\Users\Administrator\Desktop\desktop\v2d2SupuhHvTOEac-7loLQ%3D%3D%2F1365593466877484.jpg";
        let arr:Array<boolean> = (():Array<boolean>=> {
            return [];
        })();
        this.products = [
            new Product(1, 'pro1', ['p1', 'p2'], imgsrcStr, 2),
            new Product(2, 'pro2', ['p2', 'p3'], imgsrcStr, 3),
            new Product(3, 'pro3', ['p4'], imgsrcStr, 4),
            new Product(3, 'pro3', ['p4'], imgsrcStr, 1),
            new Product(3, 'pro3', ['p4'], imgsrcStr, 0),
            new Product(3, 'pro3', ['p4'], imgsrcStr, 5),
            new Product(3, 'pro3', ['p4'], imgsrcStr, 1),
            new Product(4, 'pro4', ['p5'], imgsrcStr, 3),
            new Product(4, 'pro4', ['p5'], imgsrcStr, 1)
        ];
        //console.log(this.routeParams.snapshot.params);
        let params:any = this.routeParams.params.subscribe((params:Params)=> {
            this.testid = params['testid'];
        });
        console.log("this.testid -- > ", this.testid);
    }
}
export class Product {
    constructor(public id:number,//商品id
                public name:string,//商品名字
                public cat:Array<string>,//商品分类
                public imgsrc:string,//商品图片url地址
                public grade:number//商品频分
    ) {
    }
}

